import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutterroom/widgets/page_content.dart';

class LoginPage extends StatefulWidget {
  @override
  _LoginPageState createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
  final router = Router();
  bool showPassword = false;
  @override
  Widget build(BuildContext context) {
    var scaffold = Scaffold(
      appBar: AppBar(
        title: Text("登录"),
      ),
      body: SafeArea(
        minimum: EdgeInsets.all(30),
        child: ListView(
          children: <Widget>[
            Padding(padding: EdgeInsets.all(10)),
            TextField(
              decoration: InputDecoration(labelText: "用户名", hintText: "请输入用户名"),
            ),
            Padding(padding: EdgeInsets.all(5)),
            TextField(
              decoration: InputDecoration(
                  labelText: "密码",
                  hintText: "请输入密码",
                  suffix: IconButton(
                    icon: Icon(
                        showPassword ? Icons.visibility_off : Icons.visibility),
                    onPressed: () {
                      setState(() {
                        showPassword = !showPassword;
                      });
                    },
                  )),
              //密码模式
              obscureText: !showPassword,
            ),
            Padding(padding: EdgeInsets.all(25)),
            Container(
              height: 44,
              child: RaisedButton(
                color: Colors.green,
                onPressed: () {},
                child: Text("登录",style: TextStyle(color:Colors.white),),
              ),
            ),
            Padding(padding: EdgeInsets.all(5)),
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Text("还没有账号，"),
                FlatButton(
                    onPressed: () {
                      Navigator.pushNamed(context, "/register");
                    },
                    child: Text(
                      "去注册~",
                      style: TextStyle(color: Colors.green),
                    ))
              ],
            )
          ],
        ),
      ),
    );
    return scaffold;
  }
}
